import Vue from 'vue'
import Router from 'vue-router'
import Layout from '../views/layout/Layout'

Vue.use(Router)
export const constantRoutes = [
    { path: '/login', component: () => import('@/views/login/index'), hidden: true },
    { path: '/404', component: () => import('@/views/404'), hidden: true },

    {
        path: '/',
        component: Layout,
        redirect: '/home',
        // meta: { title: '工作台', icon: 'table' },
        children: [{
            path: '/home',
            name: '',
            meta: { title: '工作台', icon: 'table' },
            component: () => import('@/views/home/index')
        }]
    }]

const createRouter = () => new Router({
    mode: 'history',
    scrollBehavior: () => ({ y: 0 }),
    routes: constantRoutes
})

const router = createRouter()
export default router
